package com.qos.fun;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

public class CountActivity extends Activity {
	private static final String LOG="countact";  

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(LOG, "Activity on Create");
    }
    
    public static class CountingFragment extends Fragment {

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setHasOptionsMenu(true);
        }

        @Override
        public void onCreateOptionsMenu(Menu menu,MenuInflater inflater) {
            inflater.inflate(R.menu.activity_count, menu);
            super.onCreateOptionsMenu(menu, inflater);
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item){
            switch(item.getItemId()) {
                case R.id.queue_all:
                	Log.d(LOG, "all queue");
                	Toast.makeText(getActivity(), "all queue!", Toast.LENGTH_SHORT).show();
                    break;
                    
                default:
                    break;
                    }
            return true;
        }

        /**
         * The Fragment's UI is just a simple text view showing its
         * instance number.
         */
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            Log.d(LOG, "fragment on Create view");
            return inflater.inflate(R.layout.activity_queue, container, false);
        }

    }
}
